1. Field of the Invention
The present invention relates generally to timers and derived timers.
2. Description of the Related Art
In real-time systems, timers are frequently used in the performance of periodic jobs or tasks such as status polling, performance monitoring, and statistics collection, to name but a few examples. Timers can be used to calculate the amount of traffic at a node or port in a storage area network. Timers may be used to determine the status of a device connected to a port of a switch in such a network. The types and numbers of tasks and systems in which they are used are endless. Nevertheless, a common problem for many applications is that the maximum duration for each instance of such tasks is typically constrained to some fixed amount of time. Consider a task to poll the status of a pin for example. The amount of time between issuing a command to poll the pin status and receiving a result can be constrained to some maximum duration. If the result is not received within this maximum constrained amount of time, the system can fail the task and take appropriate action such as re-issuing the command, etc. So long as the interval or resolution of the timer is larger than the maximum duration for the task, the timer will not be overrun. If the timer interval is shorter than the maximum task duration, however, the timer will be overrun because the task cannot complete within the prescribed time period. One solution is to increase the timer interval.
Increasing a timer interval, however, may have negative effects on task-processing in many practical real-time systems. In many systems, there are a multitude of applications having many jobs or tasks that must be done periodically using a timer. Increasing the interval of the timer leads to coarser and coarser timer resolution. Many real-time tasks have hard time limits. If the timer resolution becomes too coarse to meet the hard time limit for such a job, the job will fail. For example, a job may collect statistical or performance information at short time intervals to provide real-time statistical and performance updates (e.g. traffic load at a port of a storage area network switch). If the system's timer interval is increased to avoid overrun for some other task, the real-time updates may no longer be possible.
Thus, a tradeoff exists between avoiding timer overrun and avoiding the failure of jobs having hard time limits. If the interval of a timer is X, and the maximum duration of each task is Y, the number of tasks that can be executed is constrained to less than (X/Y). If the maximum duration of each job Y increases, the interval of the timer X must be increased to ensure that all jobs complete within the timer interval. At some point, however, the timer resolution may become so coarse that jobs having a hard time limit will fail.
Such problems can be exacerbated in systems where a single processor handles tasks for multiple devices such as multiple ports of a storage switch with different port speeds. Various tasks associated with each port may require a timer interval of varying resolution. For example, calculating the data transferred at a slower port may not need as short an interval as calculating the data transferred at a faster port. Numerous other examples of timer resolution conflicts amongst tasks in such environments will be apparent.
Accordingly, there is a need for timing techniques for multiple tasks having different timer resolution requirements that avoid timer overrun and provide hard time limits for needed tasks.